package br.com.diego.system.controller.consultapermissao;

import br.com.diego.system.controller.cadastropermissao.PermissaoVo;
import br.com.diego.system.entity.permissao.Permissao;
import br.com.diego.system.manager.permissao.PermissaoManager;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;

public class ConsultaPermissaoFactory {

    @Autowired
    private PermissaoManager permissaoManager;

    public List<PermissaoVo> consultar(ConsultaPermissaoVo consultaPermissaoVo) {        
        List<PermissaoVo> permissaoVoList = new ArrayList<PermissaoVo>();        
        List<Permissao> permissaoList = permissaoManager.consultar(consultaPermissaoVo);
        
        for (Permissao permissao : permissaoList) {
            PermissaoVo permissaoVo = new PermissaoVo(permissao);
            permissaoVoList.add(permissaoVo);
        }
        return permissaoVoList;
    }
}
